# 作者: YYJ
# 2025年07月17日15时58分13秒
# 2486249622@qq.com

class Parent():
    def __init__(self, name):
        print("Parent的init被调用")
        self.name = name
        print("Parent的init调用结束")


class Son1(Parent):
    def __init__(self, name, age, gender):
        print("Son1的init被调用")
        self.age = age
        super().__init__(name, gender)
        # Parent.__init__(self, name)
        print("Son1的init调用结束")

class Son2(Parent):
    def __init__(self, name, gender):
        print("Son2的init被调用")
        self.gender = gender
        super().__init__(name)
        # Parent.__init__(self, name)
        print("Son2的init调用结束")

class Grandson(Son1, Son2):
    def __init__(self, name, age, gender):
        print("Grandson的init被调用")
        # Son1.__init__(self, name, age)
        # Son2.__init__(self, name, gender)
        super().__init__(name, age,  gender)
        print("Grandson的init调用结束")


if __name__ == '__main__':
    gs = Grandson("小王", 18, "男")
    print(gs.name)
    print(gs.age)
    print(gs.gender)